package com.woniuxy.stage3demo.service.kang.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.stage3demo.bean.kang.CustomerMsgBean;
import com.woniuxy.stage3demo.mapper.kang.CustomerMsgMapper;
import com.woniuxy.stage3demo.pageHelper.PageRequest;
import com.woniuxy.stage3demo.service.kang.ICustomerMsgService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
@Transactional(readOnly = true)
public class CustomerMsgServiceImpl implements ICustomerMsgService {

    @Resource
    private CustomerMsgMapper customerMsgMapper;

    @Override
    public PageInfo<CustomerMsgBean> findByCustomerId(PageRequest pageRequest, int id) {
        return PageHelper.startPage(pageRequest.getPageNum(),pageRequest.getLimit()).doSelectPageInfo(()->customerMsgMapper.findByCustomerId(pageRequest,id));
    }

    @Override
    public int countByCustomerId(int id) {
        return customerMsgMapper.countByCustomerId(id);
    }

    @Override
    public int countByCustomerDId(int id) {
        return customerMsgMapper.countByCustomerDId(id);
    }

    @Override
    public int countByCUId(int id) {
        return customerMsgMapper.countByCUId(id);
    }

    @Override
    public int countByCUDId(int id) {
        return customerMsgMapper.countByCUDId(id);
    }
}
